#include <stdio.h>
#include <windows.h>

int main(int argc, char* argv[]) {
	if (argc != 2) {
		printf("Usage : %s error_code\n", argv[0]);
		return 0;
	}
	
	{
		char* pmsg;
		if (FormatMessage(
			FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
			NULL,
			atoi(argv[1]),
			MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
			(LPSTR)&pmsg, 0, NULL)
			
			!= 0) {
			printf("error code: %u, error message: %s", atoi(argv[1]), pmsg);
			LocalFree(pmsg);
		} else {
			printf("get error message failure\n");
		} // end if
	}
	return 0;
}
